/* eslint-disable no-unused-vars */
import React, { useState } from 'react';
import { Modal, Button } from 'antd';
import Print from '@/components/admin-print';

/**
 * @description 引入制定好的重庆市停车备案登记证并进行打印
 */
export default (props) => {
	const { flag, id } = props;
	const [isModalVisible, setIsModalVisible] = useState(flag);

	const handleOk = () => {
		setIsModalVisible(false);
		window.print();
	};

	const handleCancel = () => {
		setIsModalVisible(false);
	};

	return (
		<div>
			<Modal
				title="打印"
				visible={isModalVisible}
				width="850px"
				onCancel={handleCancel}
				footer={[
					<Button key="submit" type="primary" onClick={handleOk} style={{ textAlign: 'center' }}>
						打印
					</Button>,
				]}
			>
				<Print id={id} />
			</Modal>
		</div>
	);
};
